package com.generator.database.extrepository;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Repository;

import com.generator.database.model.TbCreditOperationArticle;
import com.generator.database.readwriteseparate.DataSourceSign;
import com.generator.database.readwriteseparate.DynamicDataSourceHolder;
/**
 * 扩展TbCreditOperationArticleMapper
 * 2018-4-13 10:26:50
 * @author chenjinlong
 */
@Repository
public interface ExtTbCreditOperationArticleMapper {
    
	/**
	 * 扩展查询行数
	 * @param record
	 * @param pkIds
	 * @param plateIds
	 * @return
	 */
	@DataSourceSign(sign=DynamicDataSourceHolder.SLAVE_DATASOURCE)
	public Long selectExtCount(@Param("record") TbCreditOperationArticle record,
    		@Param("pkIds") List<Long> pkIds,@Param("plateIds") List<Long> plateIds);
	
	/**
	 * 扩展查询分页
	 * @param record
	 * @param pageable
	 * @param pkIds
	 * @param plateIds
	 * @return
	 */
	@DataSourceSign(sign=DynamicDataSourceHolder.SLAVE_DATASOURCE)
    public List<TbCreditOperationArticle> selectExtPage(@Param("record") TbCreditOperationArticle record, @Param("pageable") Pageable pageable,
    		@Param("pkIds") List<Long> pkIds,@Param("plateIds") List<Long> plateIds);
    
	/**
	 * 阅读数量+1
	 * @param pkId
	 * @return
	 */
	@DataSourceSign(sign=DynamicDataSourceHolder.MASTER_DATASOURCE)
	public Integer viewCountPlusOne(Long pkId);
	
	/**
	 * 点赞+1
	 * @param pkId
	 * @return
	 */
	@DataSourceSign(sign=DynamicDataSourceHolder.MASTER_DATASOURCE)
	public Integer upCountPlusOne(Long pkId);
	
	/**
	 * 点踩+1
	 * @param pkId
	 * @return
	 */
	@DataSourceSign(sign=DynamicDataSourceHolder.MASTER_DATASOURCE)
	public Integer downCountPlusOne(Long pkId);
}